package edu.scau.pos.domain;

import java.util.Date;

import java.io.Serializable;

import edu.scau.payment.domain.Payment;
import edu.scau.pos.vo.OrdersVo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * (Orders)实体类
 *
 * @author hwh
 * @since 2025-03-30 14:53:05
 */

@Tag(name = "订单表domain", description = " 订单表domain")
@Data
public class Orders implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(name = "id", description = "自增编号", type = "Integer")
    private long id;

    @Schema(name = "orderId", description = "订单编号", type = "String")
    private String orderId;

    @Schema(name = "SaleId", description = "关联消息流程id", type = "String")
    private String saleId;

    @Schema(name = "amount", description = "订单金额", type = "String")
    private double amount;

    @Schema(name = "quantity", description = "订单商品总数", type = "int")
    private int quantity;

    @Schema(name = "discountAmount", description = "打折金额", type = "String")
    private double discountAmount;

    @Schema(name = "isDeleted", description = "删除标记, 0:未删除", type = "Integer")
    private int isDeleted;

    @Schema(name = "status", description = "订单状态", type = "Integer")
    private Integer status;

    @Schema(name = "paymentId", description = "支付详情", type = "String")
    private String paymentId;

    @Schema(name = "payment", description = "支付订单", type = "String")
    private Payment payment;

    @Schema(name = "strategyId", description = "打折策略", type = "String")
    private String strategyId;

//    @Schema(name = "strategyId", description = "打折策略", type = "String")
//    private StrategyOwn strategyOwn;

    //在一对多关系，通常由多方连接1方id
    @Schema(name = "saleLineItems", description = "商品详情",type = "Date")
    private List<SaleLineItem> saleLineItems;

    @Schema(name = "createBy", type = "String")
    private String createBy;

    @Schema(name = "createTime", type = "Date")
    private Date createTime;

    @Schema(name = "updateBy", type = "String")
    private String updateBy;

    @Schema(name = "updateTime", type = "Date")
    private Date updateTime;



    public Orders() {
    }

    public Orders(long id, String orderId, double amount, double discountAmount, int isDeleted, Integer status, String paymentId, Payment payment, String strategyId, List<SaleLineItem> saleLineItems, String createBy, Date createTime, String updateBy, Date updateTime) {
        this.id = id;
        this.orderId = orderId;
        this.amount = amount;
        this.discountAmount = discountAmount;
        this.isDeleted = isDeleted;
        this.status = status;
        this.paymentId = paymentId;
        this.payment = payment;
        this.strategyId = strategyId;
        this.saleLineItems = saleLineItems;
        this.createBy = createBy;
        this.createTime = createTime;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
    }


    public Orders(OrdersVo orders) {
        this.orderId = orders.getOrderId();
        this.amount = orders.getAmount();
        this.discountAmount = orders.getDiscountAmount();
        this.status = orders.getStatus();
    }
}
